"""
@Project ：Python_Learning 
@File    ：26.删除有序数组中的重复项.py
@IDE     ：PyCharm 
@Author  ：zhupp
@Date    ：2024/10/15 21:37 
"""

test = [1,2,3,4,5]
print(max(test))
class Solution:
    def remove_duplicates(self, nums: list[int]) -> int:
        if len(nums) == 0:
            return 0

        index = 0

        for i in range(1, len(nums)):
            if nums[i] != nums[index]:
                nums[index + 1] = nums[i]
                index += 1

        return len(nums[:nums.index(max(nums))])


solu = Solution()
print(solu.remove_duplicates([0,0,1,1,1,2,2,3,3,4]))

# [0,0,1,1,1,2,2,3,3,4]
# [0,1,0,1,1,2,2,3,3,4]